import { lookResumeList, lookOneResume, updateSubmitResume } from '@/api/resume'

const getDefaultState = () => {}

const state = getDefaultState()

const mutations = {}

const actions = {
  // 获取简历列表
  async lookResumeList({ commit }, data) {
    return new Promise((resolve, reject) => {
      lookResumeList(data)
        .then((res) => {
          resolve(res)
        })
        .catch((err) => {
          reject(err)
        })
    })
  },
  // 获取简历
  async lookOneResume({ commit }, id) {
    return new Promise((resolve, reject) => {
      lookOneResume(id)
        .then((res) => {
          resolve(res)
        })
        .catch((err) => {
          reject(err)
        })
    })
  },
  // 修改简历提交状态
  async updateSubmitResume({ commit }, data) {
    return new Promise((resolve, reject) => {
      updateSubmitResume(data)
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
}
